/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.f1x.api.message.fields;

// Generated by org.f1x.tools.DictionaryGenerator from QuickFIX dictionary
public enum PosType implements org.f1x.api.message.types.StringEnum {
	TRANSACTION_QUANTITY("TQ"),
	INTRA_SPREAD_QTY("IAS"),
	INTER_SPREAD_QTY("IES"),
	END_OF_DAY_QTY("FIN"),
	START_OF_DAY_QTY("SOD"),
	OPTION_EXERCISE_QTY("EX"),
	OPTION_ASSIGNMENT("AS"),
	TRANSACTION_FROM_EXERCISE("TX"),
	TRANSACTION_FROM_ASSIGNMENT("TA"),
	PIT_TRADE_QTY("PIT"),
	TRANSFER_TRADE_QTY("TRF"),
	ELECTRONIC_TRADE_QTY("ETR"),
	ALLOCATION_TRADE_QTY("ALC"),
	ADJUSTMENT_QTY("PA"),
	AS_OF_TRADE_QTY("ASF"),
	DELIVERY_QTY("DLV"),
	TOTAL_TRANSACTION_QTY("TOT"),
	CROSS_MARGIN_QTY("XM"),
	INTEGRAL_SPLIT("SPL");

	private final String code;

	PosType (String code) {
		this.code  = code;
		bytes = code.getBytes();
	}

	public String getCode() { return code; }

	private final byte[] bytes;
	public byte[] getBytes() { return bytes; }


	public static PosType parse(String s) {
		switch(s) {
			case "TQ" : return TRANSACTION_QUANTITY;
			case "IAS" : return INTRA_SPREAD_QTY;
			case "IES" : return INTER_SPREAD_QTY;
			case "FIN" : return END_OF_DAY_QTY;
			case "SOD" : return START_OF_DAY_QTY;
			case "EX" : return OPTION_EXERCISE_QTY;
			case "AS" : return OPTION_ASSIGNMENT;
			case "TX" : return TRANSACTION_FROM_EXERCISE;
			case "TA" : return TRANSACTION_FROM_ASSIGNMENT;
			case "PIT" : return PIT_TRADE_QTY;
			case "TRF" : return TRANSFER_TRADE_QTY;
			case "ETR" : return ELECTRONIC_TRADE_QTY;
			case "ALC" : return ALLOCATION_TRADE_QTY;
			case "PA" : return ADJUSTMENT_QTY;
			case "ASF" : return AS_OF_TRADE_QTY;
			case "DLV" : return DELIVERY_QTY;
			case "TOT" : return TOTAL_TRANSACTION_QTY;
			case "XM" : return CROSS_MARGIN_QTY;
			case "SPL" : return INTEGRAL_SPLIT;
		}
		return null;
	}

}